package cn.edu.bupt.scidata.service.impl;

import cn.edu.bupt.scidata.mapper.newsmapper;
import cn.edu.bupt.scidata.model.paper.News;
import cn.edu.bupt.scidata.service.NewsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    private cn.edu.bupt.scidata.mapper.newsmapper newsmapper;

    @Override
    public List<News> querynews(int a_id, int b_id) {
        return newsmapper.querynews(a_id,b_id);
    }

    @Override
    public List<News> querynewspage(int a_id, int b_id, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return newsmapper.querynews(a_id,b_id);
    }

    @Override
    public PageInfo<News> querynewspagef(int a_id, int b_id, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<News> lists= newsmapper.querynews(a_id,b_id);
        return new PageInfo<News>(lists);
    }
}
